<jsp:directive.page import="org.biojava.dasobert.dasregistry.DasSource" />
<jsp:directive.page import="org.biojava.dasobert.dasregistry.Das1Validator" />
<%@ page import="org.biojava.dasobert.das.Capabilities"%>
<!--want to change this to show a list of lights for core and optional capabilities: red = not working, amber=not stated as working but responds, green= stated as working and valid
need to get list of capablities from Capabilites object in the right order I want and then list them with correct icon and headers
-->
<%




for (int j=0;j<capabs.size();j++){
    
    
    String capability = capabs.get(j) ;
    if ( (testCode == null) || (testCode.equals(""))) {
    	out.print(capability + " ");
	continue;			
    }


	// we have found a testcode
	// build up the proper DAS command
	boolean showCapabilityLink = true;
	String cmd = ds.getUrl();
	if (capability.equals(Capabilities.SEQUENCE.toString())
			|| capability.equals(Capabilities.FEATURES.toString())) {
		cmd += capability + "?segment=" + testCode;

	} else if (capability.equals(Capabilities.ALIGNMENT.toString())
			|| capability.equals(Capabilities.STRUCTURE.toString())) {
		cmd += capability + "?query=" + testCode;
	} else if (capability.equals(Capabilities.ENTRY_POINTS.toString())) {
		cmd += capability;
	} else if (capability.equals(Capabilities.STYLESHEET.toString())) {
		cmd += capability;
	} else if (capability.equals(Capabilities.TYPES.toString())) {
		cmd += capability;
	} else if (capability.equals(Capabilities.INTERACTION.toString())) {
		cmd += capability + "?interactor=" + testCode;
	}else if (capability.equals(Capabilities.ERROR_SEGMENT.toString())) {
		cmd+="features?"+"segment="+Das1Validator.invalidTestCode;
	} else if (capability.equals(Capabilities.UNKNOWN_SEGMENT.toString())) {
		cmd+="features?"+"segment="+Das1Validator.invalidTestCode;
	} else if (capability.equals(Capabilities.UNKNOWN_FEATURE.toString())) {
		cmd+="features?"+"segment="+Das1Validator.invalidTestCode;
	} 

	else {
		out.print(" " + capability);
		showCapabilityLink = false;
	}

	if (showCapabilityLink) {
%>
<div title="header=[show DAS response] body=[following this link shows the DAS - <%=capability %> command for this server and its response in a new window.]">
		<a href="javascript:openWindow('<%=cmd%>','',700,700)"><%=capability%></a>
</div>
<%
	}
}
%>
